/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mygame.Entities.Character;

import base.Character;
import com.jme3.asset.AssetManager;
import com.jme3.export.InputCapsule;
import com.jme3.export.JmeExporter;
import com.jme3.export.JmeImporter;
import com.jme3.export.OutputCapsule;
import com.jme3.export.Savable;
import com.jme3.scene.Spatial;
import java.io.IOException;

/**
 *
 * @author Paulo
 */
public class CharacterEntity implements Savable {
    private Character data;
    private Spatial model;
    
    public CharacterEntity() {
        this.data = new Character();
    }
    
    private void loadModel(AssetManager assets, String name) {
        model = assets.loadModel(name);
    }
    
    public Spatial getModel() {
        return this.model;
    }
    
    public Character getData() {
        return this.data;
    }

    public void write(JmeExporter ex) throws IOException {
        OutputCapsule out = ex.getCapsule(this);
        out.write(model, "model", null);
        out.write(data, "data", null);
    }

    public void read(JmeImporter im) throws IOException {
        InputCapsule in = im.getCapsule(this);
        model = (Spatial) in.readSavable("model", null);
        data = (Character) in.readSavable("data", null);
    }
}
